package com.spark.lola.logistics.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.spark.lola.logistics.entity.DriverInfo;
import com.spark.lola.support.core.vo.SelectMap;
import com.spark.lola.support.mybatis.entity.QueryParam;
import com.spark.lola.support.mybatis.service.BaseService;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author: Zhi-peng wang
 * @date: 2020/04/24 13:05
 * 驾驶员信息业务接口
 **/
@Transactional
public interface DriverInfoService extends BaseService<DriverInfo> {

    /**
     * @description: 分页查询驾驶员信息
     * @author: wzp
     * @date: 2020/4/24
     */
    IPage<DriverInfo> findPage(QueryParam<DriverInfo> queryParam);

    DriverInfo findInfo(long driverId);

    /**
     * @description: 检查车辆是否已绑定
     * @param: carId 车辆id
     * @return: boolean 是否绑定
     * @author: wzp
     * @date: 2020/4/30
     */
    boolean carIdExists(long carId);

    /**
     * @description: 检查账号是否已绑定
     * @param: empId 账号id
     * @return: boolean 是否绑定
     * @author: wzp
     * @date: 2020/4/30
     */
    boolean empIdExists(long empId);

    /**
     * @description: 绑定车辆
     * @param: driverId 驾驶员id
     * @param: carId 车辆id
     * @return: int 影响行数
     * @author: wzp
     * @date: 2020/4/26
     */
    int bindCar(Long carId, int isBind, long driverId);

    /**
     * @description: 查询车辆id
     * @param: id 驾驶员id
     * @return: Long 车辆id
     * @author: wzp
     * @date: 2020/4/26
     */
    Long findCarId(long id);

    List<SelectMap> selectMap(String key, int isBind);

    List<SelectMap> findMap();

}
